package com.service.impl;

import com.domain.NewbookProposal;
import com.entity.PageResult;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.mapper.NewbookProposalMapper;
import com.service.NewbookProposalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class NewbookProposalServiceImpl implements NewbookProposalService {
    @Autowired
    private NewbookProposalMapper newbookProposalMapper;

    @Override
    public PageResult searchNewbookProposal(int pageNum, int PageSize) {
        //开启分页查询
        PageHelper.startPage(pageNum,PageSize);
        //调用dao
        Page<NewbookProposal> newbookProposalPage=newbookProposalMapper.searchNewbookProposal();
        return new PageResult(newbookProposalPage.getTotal(),newbookProposalPage.getResult());
    }

    @Override
    public NewbookProposal findByid(String id) {
        return null;
    }

    @Override
    public Integer addNewbookProposal(NewbookProposal newbookProposal) {
        return newbookProposalMapper.addNewbookProposal(newbookProposal);
    }

    @Override
    public void delNewbookProposal(String id) {
        newbookProposalMapper.delNewbookProposal(id);
    }

    @Override
    public Integer editNewbookProposal(String id) {
        return newbookProposalMapper.editNewbookProposal(id);
    }
}
